package com.cjk.console.job;

import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cjk.foundation.dao.DeviceDao;
import com.cjk.foundation.enums.ConfStatus;
import com.cjk.foundation.enums.DeviceStatus;

@Component
public class DeviceOnOffJob implements Job {
	
	@Autowired
	private DeviceDao deviceDao;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		Date date = new Date(new Date().getTime() - 5 * 60 * 1000);
		deviceDao.offLine(DeviceStatus.OFFLINE, ConfStatus.NOT_SYNC, date);
		deviceDao.stopPlay(date);
	}
	
}
